//by K1 2018.10.23 - 2022.2.8

corpseRd_hidebody2 = {
	{
		hidebody _x;
		_x spawn {sleep 13; deleteVehicle _this};
	} forEach _this; 
};
corpseRd_delDead = {
	{
		_veh = _x;
		if (({_veh distance _x < _this} count allPlayers) == 0) then {
			if (!alive _veh) then [{
				deleteVehicle _veh;
			},{
				if (({!alive _x} count crew _veh) > 0) then {_veh remoteExec ["corpseRd_del_crew2", _veh]};
			}];
		};
	} forEach vehicles;

	_DeadARR = [];
	{
		_Dead = _x;
		if (({_Dead distance _x < _this} count allPlayers) == 0) then {
		    if (({_Dead distance _x < 400} count allPlayers) > 0 && {_Dead isKindOf "CaManBase"}) then [{_DeadARR pushback _Dead},{deleteVehicle _Dead}];
		};
	} forEach allDead;
	if (count _DeadARR > 0) then {_DeadARR spawn corpseRd_hidebody2};
	
	{
		_obj = _x;
		if ( (getText (configFile >> "CfgVehicles" >> typeOf _obj >> "displayName") in ["地面","Ground"] || {_obj isKindOf "weaponHolder"}) && {({_obj distance _x < _this} count allPlayers) == 0} ) then {deleteVehicle _obj};
	} forEach (allMissionObjects "");
};

if (!isServer) exitwith {}; //
if (Escape_delDead == 0) exitWith {}; //
0 spawn {
	waitUntil {!isNil "A3E_StartPos" && {!isNil "A3E_fnc_GetPlayers"}};
	waitUntil {sleep 1; {_x distance A3E_StartPos < 20} count (call A3E_fnc_GetPlayers) > 0}; //
	_t = time + 60; //
	while {true} do {
		sleep 1;
		if (time > _t && {count allDead > delDead_corpse2}) then {
			delDead_distance2 call corpseRd_delDead;
			_t = time + 60;
		};
	};
};


